// var isPalindrome = function (x) {
//     let str = x.toString();
//     let arr = str.split('');
//     let newArr = arr.reverse();
//     let newStr = newArr.join('');
//     return str === newStr;
// };

// var isPalindrome = function (x) {
//     let res = 0;
//     let current = x;
//     while (current) {
//         let last = current % 10;
//         current = Math.floor(current / 10);
//         res = res * 10 + last;
//     }
//     return res === x;
// }

let str = 'yesey'
var isPalindrome = function (str) {
    let i = 0;
    let j = str.length - 1;
    while (i < j) {
        if (str[i] === str[j]) {
            i++;
            j--;
        } else {
            return false;
        }
    }
    return true;
}


console.log(isPalindrome(str));
